package com.hzcx.app.simplechat.ui.friend.presenter;

import android.content.Context;

import com.hzcx.app.simplechat.api.BaseDialogObserver;
import com.hzcx.app.simplechat.base.BasePresenter;
import com.hzcx.app.simplechat.model.FriendModel;
import com.hzcx.app.simplechat.ui.friend.bean.FriendBean;
import com.hzcx.app.simplechat.ui.friend.contract.FriendListByLableContract;
import com.hzcx.app.simplechat.ui.setting.contract.GroupMsgFriendListContract;

import org.litepal.LitePal;
import org.litepal.crud.callback.FindMultiCallback;

import java.util.List;

public class FriendListByLablePresenter extends BasePresenter<FriendListByLableContract.View> implements FriendListByLableContract.Presenter {

    /**
     * 获取好友列表
     *
     * @param context
     */
    @Override
    public void getFriendList(Context context) {
//        FriendModel.getFriendList(context, new BaseDialogObserver<List<FriendBean>>(context) {
//            @Override
//            protected void onSuccess(List<FriendBean> data) {
//                mView.friendListResult(data);
//            }
//        });
        LitePal.findAllAsync(FriendBean.class, true).listen(new FindMultiCallback<FriendBean>() {
            @Override
            public void onFinish(List<FriendBean> list) {
                if (mView != null) {
                    mView.friendListResult(list);
                }
            }
        });
    }
}
